package com.ray.basic;

import java.lang.reflect.Array;
import java.util.*;

public class test222 {
    public static void main(String[] args) {
//        int a[] = {1,2,3};
//        System.out.println(a.length);
        List<String> list = new ArrayList<String>();
        list.add("x");
        list.add("1");
        //设置为不能修改
//        Collection<String> clist = Collections. unmodifiableCollection(list);
//        clist. add("y"); // 运行时此行报错
        System. out. println(list);

        Iterator<String> it = list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
            it.next();
            it.remove();
        }
        System. out. println(list);
        Iterator<String> it2 = list.listIterator();
//        for(String i : list){
//            list.remove(i);
//        }
    }
}
